package com.dliu.javadesign.create.abstractfactory;

/**
 * @author yanglei
 * date 2021/3/29 9:49
 */
public class CarFactoryProducer {

    public static CarFactory getFactory(String choice){
        switch (choice){
            case "color": return new CarColorFactory();
            case "type": return new CarTypeFactory();
        }
        return null;
    }

    public static void main(String[] args) {
        CarFactory color = CarFactoryProducer.getFactory("color");
        Color red = color.doColor("red");
        red.getColor();

        CarFactory type = CarFactoryProducer.getFactory("type");
        Type bus = type.doType("bus");
        bus.getType();
    }
}
